<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="d1">Div Element</div>
<script type="text/javascript">
    var $1 = function(id){return document.getElementById(id);};
    var $2 = document.getElementById;

    alert($1('d1'));
    alert($2('d1'));

document.getElementById = (function(fn){
    return function(){ 
        return fn.apply(document,arguments);
    };
})(document.getElementById);

var $2 = document.getElementById;

</script>
</body>
</html>